package com.ruoyi.back.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.app.common.pageInfo
import com.ruoyi.back.domain.ContactWay
import com.ruoyi.back.service.ContactWayService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiImplicitParam
import io.swagger.annotations.ApiImplicitParams
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

@RestController
@RequestMapping("system/contactWay")
@Api(tags = ["系统设置-关于我们-联系方式"])
class ContactWayController {

    @Autowired
    private lateinit var contactWayService: ContactWayService

    @ApiOperation("保存app 联系信息")
    @PostMapping("save")
    fun saveContactWay(@RequestBody contactWay: ContactWay): Data<Boolean> = contactWayService.saveContactWay(contactWay)

    @ApiOperation("app 联系信息分页")
    @GetMapping("list")
    fun contactWayPage(contactWay: ContactWay): PageData<ContactWay> = contactWayService.contactWayPage(contactWay).pageInfo()

    @ApiOperation("移除app 联系信息")
    @ApiImplicitParams(
        ApiImplicitParam(name = "contactIds", value = "联系方式id 多个使用逗号", type = "path", required = true)
    )
    @PostMapping("remove/{contactIds}")
    fun removeContactWay(@PathVariable contactIds: String): Data<Boolean> = contactWayService.removeContactWay(contactIds)
}